<template>
  <div>
    <el-table v-loading="loading" :data="couponCodeList">
      <el-table-column label="券码名称" align="center" prop="couponName" />
      <el-table-column label="卡号" align="center" prop="couponNum" />
      <el-table-column label="卡密" align="center" prop="couponPwd" />
      <el-table-column
        label="券码到期时间"
        align="center"
        prop="couponOutTime"
      />
      <el-table-column label="券码金额" align="center" prop="couponPrice" />
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { listVir } from "@/api/system/couponCode";
export default {
  name: "couponVirtual",
  props: {
    couponCodeList: {
      type: Array,
    },
    total: {
      default: 0,
    },
    queryParams: {
      type: Object,
    },
    loading: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  created() {
    // this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      console.log(this.$route.query);
      this.queryParams.cid = this.$route.query.cid;
      listVir(this.queryParams).then((response) => {
        this.couponCodeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
  },
};
</script>
<style></style>
